csv-filter: add --quote-char#340
csv-filter: add --quote-char#340BurdetteLamar wants to merge 1 commit intoruby:mainfrom BurdetteLamar:csv_filter_option_quote_char
Conversation
| quote_char = "'" | ||
| csv = CSV.generate(quote_char: quote_char) do |csv| | ||
| csv << ['foo', 0] | ||
| csv << ["'bar'", 1] | ||
| csv << ['"baz"', 2] | ||
| end |
There was a problem hiding this comment.
| quote_char = "'" | |
| csv = CSV.generate(quote_char: quote_char) do |csv| | |
| csv << ['foo', 0] | |
| csv << ["'bar'", 1] | |
| csv << ['"baz"', 2] | |
| end | |
| csv = "foo,0\n'''bar''',1\n\"baz\",2\n" |
| csv << ['"baz"', 2] | ||
| end | ||
| assert_equal(["foo,0\n'''bar''',1\n\"baz\",2\n", ""], | ||
| run_csv_filter(csv, "--quote-char=:")) |
There was a problem hiding this comment.
Is --quote-char=: a good test?
It does nothing, right?
There was a problem hiding this comment.
I think we have the same situation for --col-sep=: and --row-sep=:, don't we? They all at least test that the option is accepted?
There was a problem hiding this comment.
Really?
They use : in the input CSV:
csv/test/csv/test_csv_filter.rb
Lines 132 to 134 in 7eea19a
csv/test/csv/test_csv_filter.rb
Lines 122 to 124 in 7eea19a
| assert_equal(["foo,0\n'''bar''',1\n\"baz\",2\n", ""], | ||
| run_csv_filter(csv, "--quote-char=:")) | ||
| assert_equal(["foo,0\n'''bar''',1\n\"\"\"baz\"\"\",2\n", ""], | ||
| run_csv_filter(csv, "--input-quote-char=:")) |
There was a problem hiding this comment.
Should we specify --quote-char=... too?
There was a problem hiding this comment.
I don't understand. Doesn't the default value serve us well enough?
There was a problem hiding this comment.
--row-sep tests use --row-sep and --{input,output}-row-sep.
I think that we want to test that --quote-char configuration is overridden by --{input,output}-quote-char here. Is it incorrect?
If we want to test only --{input,output}-quote-char, we should do it in the test for --{input,output}-quote-char not the test for --quote-char.
| assert_equal(["foo,0\n'''bar''',1\n\"\"\"baz\"\"\",2\n", ""], | ||
| run_csv_filter(csv, "--input-quote-char=:")) | ||
| assert_equal(["foo,0\n'''bar''',1\nbaz,2\n", ""], | ||
| run_csv_filter(csv, "--output-quote-char=:")) |
|
Maybe you should make these tests the way you want them? |
|
Hmm. It may be better that you create "csv-filter" gem and maintain it by yourself instead of maintaining |
Okay with me; I won't do more here. I thought you might find this useful. |
|
OK. I'll remove Someone who wants to maintain can restart from https://github.com/ruby/csv/blob/7eea19a639d6c03829b337e5c916804d8e1c10cc/bin/csv-filter . |
We don't have enough maintenance resource for it. Someone who wants to maintain this can restart from https://github.com/ruby/csv/blob/7eea19a639d6c03829b337e5c916804d8e1c10cc/bin/csv-filter . See also: #340 (comment)
We don't have enough maintenance resource for it. Someone who wants to maintain this can restart from https://github.com/ruby/csv/blob/7eea19a639d6c03829b337e5c916804d8e1c10cc/bin/csv-filter . See also: #340 (comment)
No description provided.